const express = require("express");
const articleController = require("../controller/articleController");
const requireAuth = require("../middleware/requireAuth");
const router = express.Router({ mergeParams: true });

router
  .route("/")
  .post(requireAuth, articleController.createArticle)
  .get(requireAuth, articleController.getAllArticle);

router
  .route("/:id")
  .delete(requireAuth, articleController.deleteArticle)
  .patch(requireAuth, articleController.updateArticle);

router.route("/publish").post(requireAuth, articleController.publishArticle);

module.exports = router;
